package it.xiuxian.xingqiu.presenter

import android.widget.Toast
import com.alibaba.android.arouter.launcher.ARouter
import com.lzy.okgo.OkGo
import com.lzy.okgo.callback.StringCallback
import com.lzy.okgo.model.Response
import it.xiuxian.lib.base.ArouterAddress
import it.xiuxian.lib.base.BaseBean

import it.xiuxian.lib.base.BasePresenter
import it.xiuxian.lib.base.ILoadBind
import it.xiuxian.lib.http.CallBackOption
import it.xiuxian.lib.http.HttpConfig
import it.xiuxian.lib.utils.EncodeUtils
import it.xiuxian.xingqiu.bean.GongYiBean
import it.xiuxian.xingqiu.bean.SuanLiBean
import it.xiuxian.xingqiu.fragment.XingQiuFragment

import org.json.JSONObject


class XingQiuFragmentPresenter :BasePresenter<XingQiuFragment>(){
    fun getList(pageNo:String,state:String){
        var json1 = JSONObject()
        json1.put("pageNo",pageNo)
            .put("state",state)
        OkGo.post<BaseBean<SuanLiBean>>(HttpConfig.BASE_URL+"/appgongyiqiang/list")
            .params("encrypt", EncodeUtils.encodeAES(json1.toString()))
            .execute(object : CallBackOption<BaseBean<SuanLiBean>>() {}.loadBind(mView as XingQiuFragment).execute(
                object : ILoadBind<BaseBean<SuanLiBean>> {
                    override fun excute(bean: BaseBean<SuanLiBean>) {
                        if(bean.code==0){
                            (mView as XingQiuFragment).geData(bean.data)
                        }
                    }
                }
            ))
    }
}